[#assign shiro=JspTaglibs["/WEB-INF/tld/shiro.tld"] /]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>1起购管理后台</title>
    <link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css"/>
    <link href="${base}/resource/admin/css/main.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
    <style type="text/css">
        * {
            font: 12px tahoma, Arial, Verdana, sans-serif;
        }

        html, body {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
    <script type="text/javascript">
        $().ready(function () {
            /*:not(:last)*/
            var $nav = $("#nav a");
            var $menu = $("#menu dl");
            var $menuItem = $("#menu a");

            $nav.click(function () {
                var $this = $(this);
                $nav.removeClass("current");
                $this.addClass("current");
                var $currentMenu = $($this.attr("href"));
                $menu.hide();
                $currentMenu.show();
                return false;
            });

            $menuItem.click(function () {
                var $this = $(this);
                $menuItem.removeClass("current");
                $this.addClass("current");
            });

        });
    </script>
</head>
<body>
<script type="text/javascript">
    if (self != top) {
        top.location = self.location;
    }
    ;
</script>
<table class="main">
    <tr class="main-header">
        <th class="logo">
            <a href="main.do">
                <img src="${base}/resource/admin/images/admin_logo.png" style="height: 50px;">
            </a>
        </th>
        <th>
            <div id="nav" class="nav">
                <ul>
                [#list ["admin:setting", "admin:role", "admin:operator", "admin:smsTemplate", "admin:area", "admin:storage_plugin", "admin:druid"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#system" class="current">系统设置</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]
                [#list ["admin:university","admin:universityClub", "admin:member", "admin:article", "admin:activity", "admin:ad_position","admin:stagingOrder","admin:localProduct"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#service">业务管理</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]
                [#list ["admin:dbProduct","admin:dbTimes", "admin:dbOrder","admin:dbProductType"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#db">夺宝平台</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]
                [#list ["admin:wx"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#wx">微信营销</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]
                [#list ["admin:activity"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#activity">促销活动</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]
                [#list ["admin:profile"] as permission]
                    [@shiro.hasPermission name = permission]
                        <li>
                            <a href="#profile">个人中心</a>
                        </li>
                        [#break /]
                    [/@shiro.hasPermission]
                [/#list]

                </ul>
            </div>
            <div class="link">
                <strong>[@shiro.principal/]</strong>
                您好!
                <a href="/profile/info" target="iframe">[个人设置]</a>
                <a href="/logout.jsp" target="_top">[注销]</a>
            </div>
        </th>
    </tr>
    <tr>
        <td id="menu" class="menu">
            <dl id="system" class="default">
                <dt>系统设置</dt>
            [@shiro.hasPermission name="admin:setting"]
                <dd>
                    <a href="/setting/list" target="iframe">系统设置</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:role"]
                <dd>
                    <a href="/role/list" target="iframe">角色</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:operator"]
                <dd>
                    <a href="/operator/list" target="iframe">管理员</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:smsTemplate"]
                <dd>
                    <a href="/smsTemplate/list" target="iframe">短信模版</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:area"]
                <dd>
                    <a href="/area/list" target="iframe">地区管理</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:storage_plugin"]
                <dd>
                    <a href="/storage_plugin/list" target="iframe">存储插件</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:druid"]
                <dd>
                    <a href="/druid/index.html" target="iframe">Druid监控</a>
                </dd>
            [/@shiro.hasPermission]
            </dl>
            <dl id="service">
                <dt>业务管理</dt>
            [@shiro.hasPermission name="admin:member"]
                <dd>
                    <a href="/member/list" target="iframe">用户管理</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:tradeRecord"]
                <dd>
                    <a href="/tradeRecord/list" target="iframe">账户记录</a>
                </dd>
            [/@shiro.hasPermission]
                <dd>
                    <a href="/tradeRecord/giving" target="iframe">宝币赠送</a>
                </dd>
            [@shiro.hasPermission name="admin:ad_position"]
                <dd>
                    <a href="/ad_position/list" target="iframe">广告位管理</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:factory"]
                <dd>
                    <a href="/factory/list" target="iframe">[精选]厂商</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:article"]
                <dd>
                    <a href="/article/list" target="iframe">资讯新闻</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:static"]
                <dd>
                    <a href="/static/edit" target="iframe">静态化</a>
                </dd>
            [/@shiro.hasPermission]

            [@shiro.hasPermission name="admin:sms"]
                <dd>
                    <a href="/sms/send" target="iframe">短信群发</a>
                </dd>
            [/@shiro.hasPermission]
            </dl>
            <dl id="db">
                <dt>夺宝管理</dt>
            [@shiro.hasPermission name="admin:dbProductType"]
                <dd>
                    <a href="/dbProductType/list" target="iframe">商品类型</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:dbProduct"]
                <dd>
                    <a href="/dbProduct/list" target="iframe">夺宝商品</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:dbTimes"]
                <dd>
                    <a href="/dbTimes/listAll" target="iframe">夺宝期</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:dbOrder"]
                <dd>
                    <a href="/dbOrder/listAll" target="iframe">夺宝订单</a>
                </dd>
            [/@shiro.hasPermission]
            </dl>
            <dl id="wx">
                <dt>微信营销</dt>
                <dd>
                    <a href="#" target="iframe">微信配置</a>
                </dd>

            </dl>
            <dl id="activity">
                <dt>活动管理</dt>
                <dd>
                    <a href="/gglhd/list" target="iframe">刮刮乐活动</a>
                </dd>
                <dd>
                    <a href="/ggluser/list" target="iframe">用户抽奖统计</a>
                </dd>
                <dd>
                    <a href="/gglwinning/list" target="iframe">用户中奖管理</a>
                </dd>

            </dl>
            <dl id="profile">
                <dt>个人设置</dt>
            [@shiro.hasPermission name="admin:profile"]
                <dd>
                    <a href="/profile/info" target="iframe">个人信息</a>
                </dd>
            [/@shiro.hasPermission]
            [@shiro.hasPermission name="admin:profile"]
                <dd>
                    <a href="/profile/pass" target="iframe">修改密码</a>
                </dd>
            [/@shiro.hasPermission]
            </dl>
        </td>
        <td>
            <iframe id="iframe" name="iframe" src="index" frameborder="0"></iframe>
        </td>
    </tr>
</table>
</body>
[#--<script type="text/javascript">
    var websocket = null;

    //判断当前浏览器是否支持WebSocket
    if('WebSocket' in window){
        websocket = new WebSocket("ws://localhost:8030/websocket/ws");
    }
    else{
        alert('Not support websocket')
    }

    //连接发生错误的回调方法
    websocket.onerror = function(){
        setMessageInnerHTML("error");
    };

    //连接成功建立的回调方法
    websocket.onopen = function(event){
        setMessageInnerHTML("open");
    };

    //接收到消息的回调方法
    websocket.onmessage = function(){
        setMessageInnerHTML(event.data);
    };

    //连接关闭的回调方法
    websocket.onclose = function(){
        setMessageInnerHTML("close");
    };

    //监听窗口关闭事件，当窗口关闭时，主动去关闭websocket连接，防止连接还没断开就关闭窗口，server端会抛异常。
    window.onbeforeunload = function(){
        websocket.close();
    };

    //将消息显示在网页上
    function setMessageInnerHTML(innerHTML){
        //document.getElementById('message').innerHTML += innerHTML + '<br/>';
        alert(innerHTML);
    }

    //关闭连接
    function closeWebSocket(){
        websocket.close();
    }

    //发送消息
    function send(){
        var message = document.getElementById('text').value;
        websocket.send(message);
    }
</script>--]
</html>